import EditPatient from '@components/EditPatient';
<template>
    <div class="i-table-no-border">
        <Table ref="table" :columns="columns" :data="data" :loading="loading" size="small">
             <template slot-scope="{ row }" slot="info">
                <a @click="handleDetailPatient(row)">{{ row.basic }}</a>
            </template>
            <template slot-scope="{ row }" slot="diagnosis">
                <Tag v-if="row.diagnosis === 0" color="blue">初诊</Tag>
                <Tag v-if="row.diagnosis === 1" color="volcano">复诊</Tag>
                <Tag v-if="row.diagnosis === 2" color="cyan">未及时复诊</Tag>
                <Tag v-if="row.diagnosis === 3" color="green">抗复发</Tag>
                <Tag v-if="row.diagnosis === 4" color="orange">流失</Tag>
                <Tag v-if="row.diagnosis === 5" color="red">断诊</Tag>
            </template>
            <template slot-scope="{ row }" slot="label">
                <Tag v-if="row.label === 0">在乎费用</Tag>
                <Tag v-if="row.label === 1">专家</Tag>
                <Tag v-if="row.label === 2">敏感</Tag>
                <Tag v-if="row.label === 3">远程</Tag>
            </template>
            <template slot-scope="{ row }" slot="channel">
                <Badge v-if="row.channel === 0" status="success" text="微信" />
                <Badge v-if="row.channel === 1" status="processing" text="抖音" />
                <Badge v-if="row.channel === 2" status="error" text="市场转诊" />
                <Badge v-if="row.channel === 3" status="warning" text="自然到诊" />
            </template>
            <template slot-scope="{ row, index }" slot="action">
                <a @click="handleOpenDrawer">编辑</a>
                <Divider type="vertical" />
                <a @click="handleReturnVisit"> 回访 </a>
            </template>
        </Table>
        <div class="ivu-mt iuv-text-center" slot="footer">
            <Page :total="100" show-elevator show-sizer show-total></Page>
        </div>
        <edit-patient ref="editPatient" />
        <return-visit ref="returnVisit" />
    </div>
</template>
<script>
    import editPatient from '@/components/editPatient';
    import returnVisit from '@/components/returnVisit';
    export default {
        components: { editPatient, returnVisit },
        data () {
            return {
                loading: false,
                modal: false,
                model11: '',
                formData: {
                    personnel: [],
                    Occupation: '',
                    Effect: '',
                    risk: '',
                    Diagnosis: ''
                },
                columns: [
                    {
                        title: '基本信息',
                        key: 'basic',
                        slot: 'info',
                        minWidth: 150,
                        fixed: 'left'
                    },
                    {
                        title: '归属人',
                        key: 'belonger',
                        minWidth: 80
                    },
                    {
                        title: '诊疗号',
                        key: 'consultant',
                        minWidth: 100
                    },
                    {
                        title: '诊室',
                        key: 'treatmentRoom',
                        minWidth: 100
                    },
                    // {
                    //     title: '电话',
                    //     key: 'phone',
                    //     minWidth: 150
                    // },
                    {
                        title: '上次到诊',
                        key: 'lastTime',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '下次复诊',
                        key: 'nextTime',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '上次回访时间',
                        key: 'lastTime',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '下次回访时间',
                        key: 'nextTime',
                        sortable: true,
                        minWidth: 150
                    },
                    {
                        title: '就诊类型',
                        slot: 'diagnosis',
                        minWidth: 138
                    },
                    {
                        title: '患者标签',
                        slot: 'label',
                        minWidth: 138
                    },
                    {
                        title: '复诊次数',
                        key: 'frequency',
                        sortable: true,
                        minWidth: 118
                    },
                    {
                        title: '未到诊天数',
                        key: 'noArrived',
                        sortable: true,
                        minWidth: 128
                    },
                    {
                        title: '回访次数',
                        key: 'numberVisits',
                        sortable: true,
                        minWidth: 128
                    },
                    {
                        title: '地区',
                        key: 'region',
                        minWidth: 100
                    },
                    {
                        title: '来源',
                        minWidth: 120,
                        slot: 'channel'
                    },
                    {
                        title: '备注',
                        minWidth: 120,
                        key: 'remarks'
                    },
                    {
                        title: '操作',
                        minWidth: 118,
                        slot: 'action',
                        fixed: 'right'
                    }
                ],
                data: [
                    {
                        basic: '刘鸾英 女 26岁',
                        consultant: 13526587,
                        belonger: '高玲',
                        treatmentRoom: '三诊',
                        lastTime: '2016-10-03',
                        phone: 13385658568,
                        wx: 'sky15258',
                        diagnosis: Math.floor(Math.random() * 5),
                        frequency: 3,
                        noArrived: 15,
                        numberVisits: 6,
                        region: '合肥',
                        label: Math.floor(Math.random() * 3),
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 3),
                        nextTime: '2016-10-08',
                        remarks: '在外地'
                    },
                    {
                        basic: '刘鸾英 女 26岁',
                        consultant: 13526587,
                        belonger: '王艳',
                        treatmentRoom: '三诊',
                        lastTime: '2016-10-02',
                        phone: 13385658568,
                        wx: 'ss258',
                        diagnosis: Math.floor(Math.random() * 5),
                        frequency: 2,
                        noArrived: 265,
                        numberVisits: 9,
                        region: '合肥',
                        label: Math.floor(Math.random() * 3),
                        disease: '白癜风',
                        channel: Math.floor(Math.random() * 3),
                        nextTime: '2016-10-08',
                        remarks: '在等活动'
                    }
                ]
            }
        },
        methods: {
            handleOpenDrawer () {
                this.$refs.editPatient.handleOpenDrawer()
            },
            handleDetailPatient (row) {
                this.$router.push('/patient/detailed')
            },
            handleReturnVisit () {
                this.$refs.returnVisit.handleReturnVisit()
            }
        }
    }
</script>
<style scoped>
    .u-tit {
        font-size:14px;
        color:#777;
    }
</style>
